import request from "@/request/index.js"

// 获取类型列表
export function getCategoryList(params) {
  return request({
    url: '/officesupplies/officeSupplies/listCategory',
    method: 'get',
    params
  })
}

// 获取商品列表
export function getGoodsList(params) {
  return request({
    url: '/officesupplies/officeSupplies/listByCategory',
    method: 'get',
    params:params
  })
}

// 提交采购申请
export function submitPurchase(data) {
  return request({
    url: '/officesupplies/officeSuppliesPurchaseApply/insertPurchaseApply',
    method: 'post',
    data
  })
}

// 获取申请记录详情
export function getApplyRecordDetails(params) {
  return request({
    url: `/officesupplies/officeSuppliesPurchaseApply/getApplyRecordDetails`,
    method: 'get',
    params
  })
}

// 处理采购审批
export function handlePurchase(data) {
  return request({
    url: '/officesupplies/officeSuppliesBpm/handlePurchase',
    method: 'post',
    data
  })
}

// 入库操作
export function putInStorage(openSessionId, applyId, officeSuppliesIds) {
  return request({
    url: `/officesupplies/officeSuppliesPurchaseApply/putInStorageById?openSessionId=${openSessionId}&applyId=${applyId}&officeSuppliesIds=${officeSuppliesIds}`,
    method: 'post',
    data: {openSessionId, applyId, officeSuppliesIds }
  })
}

// 撤回申请
export function cancelPurchase(data) {
  return request({
    url: '/officesupplies/officeSuppliesPurchaseApply/suppliesCancel',
    method: 'post',
    params:data
  })
}

// 重新申请
export function retryPurchase(data) {
  return request({
    url: '/officesupplies/officeSuppliesPurchaseApply/retryPurchase',
    method: 'post',
    params:data
  })
}

// 删除申请
export function deletePurchase(data) {
  return request({
    url: '/officesupplies/officeSuppliesPurchaseApply/deleteApplyRecord',
    method: 'post',
    params:data
  })
}